package ru.hh.team02.chat.utils;

import java.util.HashMap;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * HashMap, but with lock, which can be acquired by getLock()
 * 
 * @param <T1,T2>
 */
@SuppressWarnings("serial")
public class HashMapWithLock<T1, T2> extends HashMap<T1, T2> {
    // adding a lock per Set to be able to lock them separately
    private final ReadWriteLock lock = new ReentrantReadWriteLock();

    public ReadWriteLock getLock() {
        return lock;
    }
}
